package com.jse.ioc.val;

import com.jse.entity.Pair;
import com.jse.ioc.Ioc;
import com.jse.ioc.IocMaking;
import com.jse.ioc.Iocs;
import com.jse.ioc.ValueProxy;

public class ReferValue implements ValueProxy {

    private String name;
    private Class<?> type;

    public ReferValue(String name) {
        Pair<Class<?>> p = Iocs.parseName(name);
        this.name = p.getName();
        this.type = p.getValue();
    }

    public Object get(IocMaking ing) {
        Ioc ioc = ing.getIoc();
        return ioc.get(type, name,ing.getContext());
    }

}
